package com.shsh.safemanage.model;

import java.io.Serializable;
import java.util.Calendar;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

import com.shsh.safemanage.util.Constants;
import com.shsh.safemanage.util.Util;

public class PostcheckMonthQualityReport implements Serializable {
	public final static Map<Long, Long> BIG_POSTCHECK_MAPPING = new HashMap<Long, Long>();
	public final static Map<Long, Long> POSTCHECK_CHUSHI_MAPPING = new HashMap<Long, Long>();
	static {
		BIG_POSTCHECK_MAPPING.put(Constants.POSTCHECK_ID_ANQUANGUANLI, Constants.POSTCHECK_ID_ANQUANGUANLI);
		POSTCHECK_CHUSHI_MAPPING.put(Constants.POSTCHECK_ID_ANQUANGUANLI, Constants.DEPARTMENT1_ID_HSEGUANLICHU);

		BIG_POSTCHECK_MAPPING.put(Constants.POSTCHECK_ID_HUANBAOGUANLI, Constants.POSTCHECK_ID_HUANBAOGUANLI);
		POSTCHECK_CHUSHI_MAPPING.put(Constants.POSTCHECK_ID_HUANBAOGUANLI, Constants.DEPARTMENT1_ID_HSEGUANLICHU);

		BIG_POSTCHECK_MAPPING.put(Constants.POSTCHECK_ID_SHENCHANGUANLI, Constants.POSTCHECK_ID_SHENCHANGUANLI);
		POSTCHECK_CHUSHI_MAPPING.put(Constants.POSTCHECK_ID_SHENCHANGUANLI, Constants.DEPARTMENT1_ID_SHENGCHANDIAODUCHU);

		BIG_POSTCHECK_MAPPING.put(Constants.POSTCHECK_ID_DONGLIXITONGZHUANYEGUANLI, Constants.POSTCHECK_ID_SHEBEIGUANLI);
		BIG_POSTCHECK_MAPPING.put(Constants.POSTCHECK_ID_SHEBEIGUANLI, Constants.POSTCHECK_ID_SHEBEIGUANLI);
		POSTCHECK_CHUSHI_MAPPING.put(Constants.POSTCHECK_ID_DONGLIXITONGZHUANYEGUANLI, Constants.DEPARTMENT1_ID_SHEBEIDONGLICHU);
		POSTCHECK_CHUSHI_MAPPING.put(Constants.POSTCHECK_ID_SHEBEIGUANLI, Constants.DEPARTMENT1_ID_SHEBEIDONGLICHU);

		BIG_POSTCHECK_MAPPING.put(Constants.POSTCHECK_ID_SHIYANSHIGUANLI, Constants.POSTCHECK_ID_GONGYIJISHUGUANLI);
		BIG_POSTCHECK_MAPPING.put(Constants.POSTCHECK_ID_ZHILIANGGUANLI, Constants.POSTCHECK_ID_GONGYIJISHUGUANLI);
		BIG_POSTCHECK_MAPPING.put(Constants.POSTCHECK_ID_JIENENGJIANGHAOGUANLI, Constants.POSTCHECK_ID_GONGYIJISHUGUANLI);
		BIG_POSTCHECK_MAPPING.put(Constants.POSTCHECK_ID_GONGYIJISHUGUANLI, Constants.POSTCHECK_ID_GONGYIJISHUGUANLI);
		POSTCHECK_CHUSHI_MAPPING.put(Constants.POSTCHECK_ID_SHIYANSHIGUANLI, Constants.DEPARTMENT1_ID_JISHUZHILIANGCHU);
		POSTCHECK_CHUSHI_MAPPING.put(Constants.POSTCHECK_ID_ZHILIANGGUANLI, Constants.DEPARTMENT1_ID_JISHUZHILIANGCHU);
		POSTCHECK_CHUSHI_MAPPING.put(Constants.POSTCHECK_ID_JIENENGJIANGHAOGUANLI, Constants.DEPARTMENT1_ID_JISHUZHILIANGCHU);
		POSTCHECK_CHUSHI_MAPPING.put(Constants.POSTCHECK_ID_GONGYIJISHUGUANLI, Constants.DEPARTMENT1_ID_JISHUZHILIANGCHU);
	}
	/**
	 * 
	 */
	private static final long serialVersionUID = 5283259937651794900L;

	private final int year;
	private final int month;
	private final int workingDay;

	private Map<Long, PostCheck> postcheckList;
	private Map<Long, Department1> shiyebuList;
	private Map<Long, Department1> chushiList;

	private Map<Long, ShiyebuReport> shiyebuReportMap;
	private Map<Long, ChushiReport> chushiReportMap;

	private Long shiyebuWriteUserID;
	private String shiyebuWriteUserName;
	private Calendar shiyebuWriteTime;
	private Long chushiWriteUserID;
	private String chushiWriteUserName;
	private Calendar chushiWriteTime;

	public PostcheckMonthQualityReport(int year, int month) {
		super();
		this.year = year;
		this.month = month;
		workingDay = Util.getWorkingday(year, month);
	}

	public String getShiyebuWriteUserName() {
		return shiyebuWriteUserName;
	}

	public void setShiyebuWriteUserName(String shiyebuWriteUserName) {
		this.shiyebuWriteUserName = shiyebuWriteUserName;
	}

	public String getChushiWriteUserName() {
		return chushiWriteUserName;
	}

	public void setChushiWriteUserName(String chushiWriteUserName) {
		this.chushiWriteUserName = chushiWriteUserName;
	}

	public Long getShiyebuWriteUserID() {
		return shiyebuWriteUserID;
	}

	public void setShiyebuWriteUserID(Long shiyebuWriteUserID) {
		this.shiyebuWriteUserID = shiyebuWriteUserID;
	}

	public Calendar getShiyebuWriteTime() {
		return shiyebuWriteTime;
	}

	public void setShiyebuWriteTime(Calendar shiyebuWriteTime) {
		this.shiyebuWriteTime = shiyebuWriteTime;
	}

	public Long getChushiWriteUserID() {
		return chushiWriteUserID;
	}

	public void setChushiWriteUserID(Long chushiWriteUserID) {
		this.chushiWriteUserID = chushiWriteUserID;
	}

	public Calendar getChushiWriteTime() {
		return chushiWriteTime;
	}

	public void setChushiWriteTime(Calendar chushiWriteTime) {
		this.chushiWriteTime = chushiWriteTime;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	public void setShiyebuWorkerCount(Long depart1ID, Integer workerCount) {
		ShiyebuReport shiyebuReport = shiyebuReportMap.get(depart1ID);
		if (shiyebuReport != null) {
			shiyebuReport.setWorkerCount(workerCount);
		}

	}

	public void setUnitCount(Long depart1ID, Integer unitCount) {
		ShiyebuReport shiyebuReport = shiyebuReportMap.get(depart1ID);
		if (shiyebuReport != null) {
			shiyebuReport.setUnitCount(unitCount);
		}

	}

	public void setEmployeeCount(Long depart1ID, Integer employeeCount) {
		ChushiReport chushiReport = chushiReportMap.get(depart1ID);
		if (chushiReport != null) {
			chushiReport.setEmployeeCount(employeeCount);
		}

	}

	public void setChushiWorkerCount(Long depart1ID, Integer workerCount) {
		ChushiReport chushiReport = chushiReportMap.get(depart1ID);
		if (chushiReport != null) {
			chushiReport.setWorkerCount(workerCount);
		}
	}

	public void setChushiCheckUnitCountNeed(Long depart1ID, Integer checkUnitCountNeed) {
		ChushiReport chushiReport = chushiReportMap.get(depart1ID);
		if (chushiReport != null) {
			int monthIndex = Util.getMonthIndexInSeason(getMonth());
			chushiReport.getCheckUnitCountNeed()[monthIndex] = checkUnitCountNeed;
		}
	}

	public void setChushiCheckUnitCountReal(Long depart1ID, Integer checkUnitCountReal) {
		ChushiReport chushiReport = chushiReportMap.get(depart1ID);
		if (chushiReport != null) {
			int monthIndex = Util.getMonthIndexInSeason(getMonth());
			chushiReport.getCheckUnitCountReal()[monthIndex] = checkUnitCountReal;
		}
	}

	public int getYear() {
		return year;
	}

	public int getMonth() {
		return month;
	}

	public int getWorkingDay() {
		return workingDay;
	}

	public Map<Long, PostCheck> getPostcheckList() {
		if (postcheckList == null) {
			postcheckList = new LinkedHashMap<Long, PostCheck>();
		}
		return postcheckList;
	}

	public void setPostcheckList(Map<Long, PostCheck> postcheckList) {
		this.postcheckList = postcheckList;
	}

	public Map<Long, Department1> getShiyebuList() {
		if (shiyebuList == null) {
			shiyebuList = new LinkedHashMap<Long, Department1>();
		}
		return shiyebuList;
	}

	public void setShiyebuList(Map<Long, Department1> shiyebuList) {
		this.shiyebuList = shiyebuList;
	}

	public Map<Long, Department1> getChushiList() {
		if (chushiList == null) {
			chushiList = new LinkedHashMap<Long, Department1>();
		}
		return chushiList;
	}

	public void setChushiList(Map<Long, Department1> chushiList) {
		this.chushiList = chushiList;
	}

	public Map<Long, ShiyebuReport> getShiyebuReportMap() {
		if (shiyebuReportMap == null) {
			shiyebuReportMap = new HashMap<Long, PostcheckMonthQualityReport.ShiyebuReport>();
		}
		return shiyebuReportMap;
	}

	public void setShiyebuReportMap(Map<Long, ShiyebuReport> shiyebuReportMap) {
		this.shiyebuReportMap = shiyebuReportMap;
	}

	public Map<Long, ChushiReport> getChushiReportMap() {
		if (chushiReportMap == null) {
			chushiReportMap = new HashMap<Long, PostcheckMonthQualityReport.ChushiReport>();
		}
		return chushiReportMap;
	}

	public void setChushiReportMap(Map<Long, ChushiReport> chushiReportMap) {
		this.chushiReportMap = chushiReportMap;
	}

	public class ChushiReport implements Serializable {

		/**
		 * 
		 */
		private static final long serialVersionUID = -3019092438173550270L;

		private Integer workerCount;
		private Integer employeeCount;
		private Integer[] checkUnitCountNeed = new Integer[3];
		private Integer[] checkUnitCountReal = new Integer[3];
		private Integer[] mantimeReal = new Integer[3];
		private Integer[] problemCount = new Integer[3];
		private Integer[] gradeSum = new Integer[3];
		private Integer[] isSanweiCount = new Integer[3];
		private Integer[] finishRate = new Integer[4];
		private Integer[] partakeRate = new Integer[4];
		private Integer[] coverageRate = new Integer[4];
		private Integer[] sanweiRate = new Integer[4];
		private Integer[] assessRate = new Integer[4];

		public Integer getWorkerCount() {
			return workerCount;
		}

		public void setWorkerCount(Integer workerCount) {
			this.workerCount = workerCount;
		}

		public Integer getEmployeeCount() {
			return employeeCount;
		}

		public void setEmployeeCount(Integer employeeCount) {
			this.employeeCount = employeeCount;
		}

		public Integer[] getCheckUnitCountNeed() {
			return checkUnitCountNeed;
		}

		public void setCheckUnitCountNeed(Integer[] checkUnitCountNeed) {
			this.checkUnitCountNeed = checkUnitCountNeed;
		}

		public Integer[] getCheckUnitCountReal() {
			return checkUnitCountReal;
		}

		public void setCheckUnitCountReal(Integer[] checkUnitCountReal) {
			this.checkUnitCountReal = checkUnitCountReal;
		}

		public Integer[] getMantimeReal() {
			return mantimeReal;
		}

		public void setMantimeReal(Integer[] mantimeReal) {
			this.mantimeReal = mantimeReal;
		}

		public Integer[] getProblemCount() {
			return problemCount;
		}

		public void setProblemCount(Integer[] problemCount) {
			this.problemCount = problemCount;
		}

		public Integer[] getGradeSum() {
			return gradeSum;
		}

		public void setGradeSum(Integer[] gradeSum) {
			this.gradeSum = gradeSum;
		}

		public Integer[] getIsSanweiCount() {
			return isSanweiCount;
		}

		public void setIsSanweiCount(Integer[] isSanweiCount) {
			this.isSanweiCount = isSanweiCount;
		}

		public Integer[] getFinishRate() {
			return finishRate;
		}

		public void setFinishRate(Integer[] finishRate) {
			this.finishRate = finishRate;
		}

		public Integer[] getPartakeRate() {
			return partakeRate;
		}

		public void setPartakeRate(Integer[] partakeRate) {
			this.partakeRate = partakeRate;
		}

		public Integer[] getCoverageRate() {
			return coverageRate;
		}

		public void setCoverageRate(Integer[] coverageRate) {
			this.coverageRate = coverageRate;
		}

		public Integer[] getSanweiRate() {
			return sanweiRate;
		}

		public void setSanweiRate(Integer[] sanweiRate) {
			this.sanweiRate = sanweiRate;
		}

		public Integer[] getAssessRate() {
			return assessRate;
		}

		public void setAssessRate(Integer[] assessRate) {
			this.assessRate = assessRate;
		}

	}

	public class ShiyebuReport implements Serializable {

		/**
		 * 
		 */
		private static final long serialVersionUID = 4444919934074293188L;

		private Integer workerCount;
		private Integer unitCount;
		private Integer mantimeNeed;
		private Integer mantimeReal;
		private Integer checkUnitCountNeed;
		private Integer checkUnitCountReal;
		private Integer isSanweiCount;

		private Integer corpProblemCount;
		private Integer isClosedCount;

		/**
		 * key = postcheck id
		 */
		private Map<Long, ShiyebuReportCell> problemCountMap;

		/**
		 * All rate is stored with real value * 100
		 */
		private Integer dailyFinishRate;
		private Integer dailyPartakeRate;
		private Integer closedRate;
		private Integer slefCheckRate;

		/**
		 * key = postcheck id
		 */
		private Map<Long, Integer> coverageMap;

		private Integer sanwei;
		private Integer assessGrade;

		public int getWorkingDay() {
			return workingDay;
		}

		public Integer getWorkerCount() {
			return workerCount;
		}

		public void setWorkerCount(Integer workerCount) {
			this.workerCount = workerCount;
		}

		public Integer getUnitCount() {
			return unitCount;
		}

		public void setUnitCount(Integer unitCount) {
			this.unitCount = unitCount;
		}

		public Integer getMantimeNeed() {
			return mantimeNeed;
		}

		public void setMantimeNeed(Integer mantimeNeed) {
			this.mantimeNeed = mantimeNeed;
		}

		public Integer getMantimeReal() {
			return mantimeReal;
		}

		public void setMantimeReal(Integer mantimeReal) {
			this.mantimeReal = mantimeReal;
		}

		public Integer getCheckUnitCountNeed() {
			return checkUnitCountNeed;
		}

		public void setCheckUnitCountNeed(Integer checkUnitCountNeed) {
			this.checkUnitCountNeed = checkUnitCountNeed;
		}

		public Integer getCheckUnitCountReal() {
			return checkUnitCountReal;
		}

		public void setCheckUnitCountReal(Integer checkUnitCountReal) {
			this.checkUnitCountReal = checkUnitCountReal;
		}

		public Integer getIsSanweiCount() {
			return isSanweiCount;
		}

		public void setIsSanweiCount(Integer isSanweiCount) {
			this.isSanweiCount = isSanweiCount;
		}

		public Integer getCorpProblemCount() {
			return corpProblemCount;
		}

		public void setCorpProblemCount(Integer corpProblemCount) {
			this.corpProblemCount = corpProblemCount;
		}

		public Integer getIsClosedCount() {
			return isClosedCount;
		}

		public void setIsClosedCount(Integer isClosedCount) {
			this.isClosedCount = isClosedCount;
		}

		public Map<Long, ShiyebuReportCell> getProblemCountMap() {
			if (problemCountMap == null) {
				problemCountMap = new HashMap<Long, PostcheckMonthQualityReport.ShiyebuReport.ShiyebuReportCell>();
			}
			return problemCountMap;
		}

		public void setProblemCountMap(Map<Long, ShiyebuReportCell> problemCountMap) {
			this.problemCountMap = problemCountMap;
		}

		public Integer getDailyFinishRate() {
			return dailyFinishRate;
		}

		public void setDailyFinishRate(Integer dailyFinishRate) {
			this.dailyFinishRate = dailyFinishRate;
		}

		public Integer getDailyPartakeRate() {
			return dailyPartakeRate;
		}

		public void setDailyPartakeRate(Integer dailyPartakeRate) {
			this.dailyPartakeRate = dailyPartakeRate;
		}

		public Map<Long, Integer> getCoverageMap() {
			if (coverageMap == null) {
				coverageMap = new LinkedHashMap<Long, Integer>();
			}
			return coverageMap;
		}

		public void setCoverageMap(Map<Long, Integer> coverageMap) {
			this.coverageMap = coverageMap;
		}

		public Integer getSanwei() {
			return sanwei;
		}

		public void setSanwei(Integer sanwei) {
			this.sanwei = sanwei;
		}

		public Integer getAssessGrade() {
			return assessGrade;
		}

		public void setAssessGrade(Integer assessGrade) {
			this.assessGrade = assessGrade;
		}

		public Integer getClosedRate() {
			return closedRate;
		}

		public void setClosedRate(Integer closedRate) {
			this.closedRate = closedRate;
		}

		public Integer getSlefCheckRate() {
			return slefCheckRate;
		}

		public void setSlefCheckRate(Integer slefCheckRate) {
			this.slefCheckRate = slefCheckRate;
		}

		public class ShiyebuReportCell implements Serializable {

			/**
			 * 
			 */
			private static final long serialVersionUID = 8092193022459589432L;

			private Integer chushiCheckCount;
			private Integer selfCheckCount;
			private Integer chushiCheckGrade;
			private Integer selfcheckedGrade;

			public Integer getChushiCheckCount() {
				return chushiCheckCount;
			}

			public void setChushiCheckCount(Integer chushiCheckCount) {
				this.chushiCheckCount = chushiCheckCount;
			}

			public Integer getSelfCheckCount() {
				return selfCheckCount;
			}

			public void setSelfCheckCount(Integer selfCheckCount) {
				this.selfCheckCount = selfCheckCount;
			}

			public Integer getChushiCheckGrade() {
				return chushiCheckGrade;
			}

			public void setChushiCheckGrade(Integer chushiCheckGrade) {
				this.chushiCheckGrade = chushiCheckGrade;
			}

			public Integer getSelfcheckedGrade() {
				return selfcheckedGrade;
			}

			public void setSelfcheckedGrade(Integer selfcheckedGrade) {
				this.selfcheckedGrade = selfcheckedGrade;
			}

		}
	}
}
